<?php
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use yii\widgets\LinkPager;
use mobile\controllers\ListController;
use common\models\articles\Articles;
use common\models\member\Member;
use common\models\category\Category;
use common\models\Ad\AdPosition;

?>
<style type="text/css">
    .swiper-button-next, .swiper-button-prev{
            -moz-background-size: 0.25rem 0.33rem;
           -webkit-background-size: 0.25rem 0.33rem;
            background-size: 0.25rem 0.33rem;
        }
        .sear .swiper-button-prev, .sear .swiper-container-rtl .swiper-button-next{
            
        }
        .sear .swiper-button-next, .sear .swiper-container-rtl .swiper-button-prev{
         
        }
</style>
<!--sear-->
<div class="sear">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <?php foreach($childcat as $ct){ ?>
                <div class="swiper-slide <?php if($cat['id'] == $ct['id']){ ?> seactive <?php } ?>">
			<?php if(!empty($ct['url'])){ ?>	
				<a href="<?= $ct['url']?>">
			<?php }else{ ?>	
			<a href="<?= yii\helpers\Url::to([$ct['type'],'id'=>$ct['id'],'z_nav'=>0]);?>">
			<?php } ?>
				<?=$ct['name'];?></a></div>

            <?php } ?>
        </div>
        <div class="swiper-button-prev swiper-button-black"></div>
        <div class="swiper-button-next swiper-button-black"></div>
    </div>
    <script>
        var swiper = new Swiper('.sear .swiper-container', {
            freeMode : true,
            slidesPerView : 'auto',
            prevButton:'.sear .swiper-button-prev',
            nextButton:'.sear .swiper-button-next'
        });
    </script>
</div>
<!--sear end-->
<div class="clearFloat bag-fff">
    <div class="sewz m-l-35 m-r-35">
        <a href="<?= yii\helpers\Url::to(['/']);?>">HOME</a>-<a href="<?= yii\helpers\Url::to([$ppinfo['type'], 'id' => $ppinfo['id'],'z_nav'=>0]); ?>"><?= $ppinfo['name'];?></a>
    </div>
</div>
<!--位置-->
<!--列表-->
<div class="selist bag-fff">
  <?php foreach($articles as $ar){ ?>
    <div class="selista m-l-35 m-r-35">
        <a href="<?= yii\helpers\Url::to([$ctype, 'id' => $ar['id'], 'z_nav'=>$z_nav]); ?>">
            <div class="selistb">
                <?=$ar['title'];?>
            </div>
            <div class="seldat">
                <?= date('Y-m-d H:i',$ar['updated_at']);?>
            </div>
        </a>
    </div>
 <?php } ?>
<!--列表-->
</div>
<a class="ggmore" id="aaa">Click to load more</a>

<script>
    $('.ggmore').click(function(){

        var articlecount = $('.selista').length;
        if(articlecount < 9){
            document.getElementById("aaa").innerHTML="No more";
        }
        var url = "<?= yii\helpers\Url::to(['list/zenjia','id'=>$cat['id']]); ?>"+'?articlecount='+articlecount;
        $.getJSON(url,function(data){
            $.each(data, function(i, item){
                var html = '<div class="selista m-l-35 m-r-35"><a href="<?= yii\helpers\Url::to(['list/newscontent']);?>/'+item.id+'?z_nav=<?=$z_nav?>">  <div class="selistb">'+item.title+'</div><div class="seldat">'+item.time+'</div></a></div>';
                $('.selist').append(html);
                if(item.content == 1){
                    document.getElementById("aaa").innerHTML="No more";
                }
            })
        })





    })
</script>